package away3d.animators.skeleton

/**
 * Author: David Lenaerts
 */
import away3d.errors.AbstractMethodError ;

import flash.geom.Vector3D ;

/**
 * SkeletonTreeNode provides an abstract base class for nodes in a skeleton blend tree.
 */
class SkeletonTreeNode
{
    
    
    
    private var _time       : Float = 0 ;
    private var _direction  : Float = 0 ;
    private var _duration   : Float = 0 ;
    public var name         : String ;
    public var skeletonPose : SkeletonPose ;
    public var rootDelta    : Vector3D<Float> ;
    
    
    /**
     * Creates a new SkeletonTreeNode object.
     * @param numJoints The amount of joint in the target skeleton.
     */
    public function new()
    {
        
        _time           = 0 ;
        _direction      = 0 ;
        _duration       = 0 ;
        rootDelta       = new Vector3D() ;
        skeletonPose    = new SkeletonPose() ;
        
    }
    
    
    public var time( get_time, set_time ): Float ;
    
    
    /**
     * The time ratio between 0 and 1.
     */
    private function get_time() : Float
    {
        
        return _time ;
        
    }
    
    
    private function set_time( value : Float ) : Float
    {
        
        _time = value ;
        return value ;
        
    }
    
    
    public var direction( get_direction, set_direction ) : Float ;
    
    
    public function get_direction() : Float
    {
        
        return _direction ;
        
    }
    
    
    public function set_direction( value : Float ) : Float
    {
        
        _direction = value ;
        return _direction ;
        
    }
    
    
    public var duration( get_duration, null ) : Float ;
    
    
    public function get_duration() : Float
    {
        
        return _duration ;
        
    }
    
    
    /**
     * Updates the node's skeleton pose
     */
    public function updatePose( skeleton : Skeleton )
    {
        
        throw new AbstractMethodError() ;
        
    }
    
    
    /**
     * Updates the s root delta position and bounds
     *
     * todo: support bounds
     */
    public function updatePositionData()
    {
        
        throw new AbstractMethodError() ;
        
    }
    
    
}
}
